import request from '@/utils/request.js'
import { getToken } from '@/utils/token.js'
import production from './image.js'
let token = getToken()

// 登录拿token
export const login = ({ data }) => {
  return request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data
  })
}

// 获取登录成功后的个人信息
// export const getProfile = () => {
//   return request({
//     method: 'GET',
//     headers: {
//       Authorization: `Bearer ${token.token}`
//     },
//     url: '/v1_0/user/profile'
//   })
// }

// 获取登录成功后的个人信息(线上的)
export const getProfileProduction = () => {
  return request({
    method: 'GET',
    headers: {
      Authorization: production.token
    },
    url: production.baseurl + 'mp/v1_0/user/profile'
  })
}

// 修改个人信息的照片
export const uploadphoto = data => {
  return request({
    method: 'PATCH',
    url: production.baseurl + 'mp/v1_0/user/photo',
    headers: {
      Authorization: production.token
    },
    data
  })
}

// 修改个人信息的资料
export const uploadProfile = data => {
  return request({
    method: 'PATCH',
    url: production.baseurl + 'mp/v1_0/user/profile',
    headers: {
      Authorization: production.token
    },
    data
  })
}
